import {reqListshpping,delListShopping,checkedList,reqRegister} from '@/api/index'
export default{
    namespaced:true,
    state:{
        shoppingList:[]
    },
    getters:{},
    actions:{
        async getListShopping(e){
            let result = await reqListshpping()
            if(result.code == 200){
                e.commit('GETLISTSHOPPING',result.data)
            }
        },
        async delShoppingList(_,e){
            let result  = await delListShopping(e)
        },
        async checkedListnow(_,e){
            let result  = await checkedList(e[0],e[1])
        },
        async getRegister(){
            let result = await reqRegister()
            if(result.code == 200){
                return result
            }else{
                return Promise.reject(new Error('这是错误信息'))
            }
        }   
    },
    mutations:{
        GETLISTSHOPPING(state,value){
            state.shoppingList = value
        }
    }
}